﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Web;

namespace Finance.Web.Models.Mapping
{
    public class PercentPenaltyMap : EntityTypeConfiguration<PercentPenalty>
    {
        public PercentPenaltyMap()
        {
            this.HasKey(t => t.Code);

            this.ToTable("PERCENTPENALTY");
            this.Property(t => t.Code).HasColumnName("PENCODE");
            this.Property(t => t.DepCode).HasColumnName("DEPCODE");
            this.Property(t => t.From).HasColumnName("FROMPERIOD");
            this.Property(t => t.To).HasColumnName("TOPERIOD");
            this.Property(t => t.Percent).HasColumnName("PERCENT");

            // Relationships
            this.HasOptional(t => t.Deposit)
                .WithMany(t => t.PercentPenalties)
                .HasForeignKey(d => d.DepCode);
        }
    }
}